//
//  XYSegementScrollView.h
//  XYAuto
//
//  Created by 小萌 on 2017/1/3.
//  Copyright © 2017年 Raymond~. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "XYButton.h"
@class XYSegementScrollView;
typedef NS_ENUM(NSInteger,XYTopSeletedSegementPosition){
    XYTopSeletedSegementPositionCenter = 0,
    XYTopSeletedSegementPositionLelfOrRight
};
typedef void(^XYSegementSeletedBlock) (XYSegementScrollView *view,XYButton *seletedBtn,NSInteger seletedIndex);
@protocol XYSegementScrollViewDelegate <NSObject>

- (void)didSeletedSegementScrollView:(XYSegementScrollView *)view btn:(XYButton *)btn index:(NSInteger)index;

@end

@interface XYSegementScrollView : UIScrollView
@property (nonatomic, assign) NSInteger preIndex;
@property (nonatomic, weak) id<XYSegementScrollViewDelegate>segementeDelegate;
/**segement数据源*/
@property (nonatomic, strong) NSArray *segementArray;
/**顶部每个button的间距 默认10（如果button平分整个屏幕，则设置间距无效。否则有效）*/
@property (nonatomic, assign) CGFloat topButtonMargin;
/**当标题总宽度小于屏幕的宽度时，若为YES 则不会平分整个屏幕 否则标题的宽度为平分整个屏幕  默认NO*/
@property (nonatomic, assign) BOOL isAutoButtonWidth;
/**顶部btn的字体大小 默认14*/
@property (nonatomic, assign) CGFloat topButtonFont;
/**顶部下划线的高度 默认3*/
@property (nonatomic, assign) CGFloat topLineHeight;
/** 第一个按钮距离左边的间距 默认与topButtonMargin一样*/
@property (nonatomic, assign) CGFloat firstBtnLeftMargin;
/**顶部下划线是否自动与文字宽度相等 默认NO */
@property (nonatomic, assign) BOOL isAutoLineWidth;
/**顶部下划线的宽度 默认9*/
@property (nonatomic, assign) CGFloat topLineWidth;
/**选中 默认选中第一个 从0开始*/
@property (nonatomic, assign) NSInteger seletedIndex;
@property (nonatomic, assign) NSInteger currentIndex;
/**
 是否允许重复点击选择btn 默认 NO
 */
@property (nonatomic, assign) BOOL isRepeatSeleted;
/** 选中字体颜色*/
@property (nonatomic, strong) UIColor *seletedColor;
/**未选中颜色*/
@property (nonatomic, strong) UIColor *normalColor;
/**选中背景图片*/
@property (nonatomic, strong) UIImage *seletedBackImage;
/**未选中背景图片*/
@property (nonatomic, strong) UIImage *normalBackImage;
/**选中图片*/
@property (nonatomic, strong) UIImage *seletedImage;
/**未选中图片*/
@property (nonatomic, strong) UIImage *normalImage;
@property (nonatomic, strong) UIImageView *backImageView;
/**是否允许文字缩放效果 默认NO*/
@property (nonatomic, assign) BOOL isSegementTitleScale;
/**缩放比例，当isSegementTitleScale为YES 才有效 默认0.1 取值0.0~1.0*/
@property (nonatomic, assign) CGFloat segementScale;
/**默认居中 当顶部segement超出屏幕时，才有效。当顶部每个segement平分屏幕时，该属性设置无效*/
@property (nonatomic, assign) XYTopSeletedSegementPosition seletedPosition;
@property (nonatomic, assign) XYButtonTitlePosition btnPosition;
@property (nonatomic, strong) UILabel *lbTopLine;//顶部下划线
@property (nonatomic, copy) XYSegementSeletedBlock  seletedBlock;
- (void)reloadScrollView;
- (void)clickBtn:(UIButton *)btn;
- (void)selectedTitleBtnColorGradualChangeScrollView:(UIScrollView *)scrollView;
@end
